package com.sky.mapper;

import com.sky.anno.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.entity.Setmeal;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishItemVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealMapper {
    //根据分类id查询套餐的数量
    @Select("select count(id) from setmeal where category_id = #{categoryId}")
    Integer countByCategoryId(Long id);

    //插入套餐基本信息
    @AutoFill(value = OperationType.INSERT)
    void add(Setmeal setmeal);

    //套餐分页查询
    List<Setmeal> findByPage(SetmealPageQueryDTO setmealPageQueryDTO);

//    判断是否有起售的套餐
    Setmeal findByStatusAndId(Long id);

    //删除套餐
    void delete(List<Long> ids);

    //根据id查询套餐和菜品关系
    Setmeal findById(Long id);

    //修改套餐基本信息
    void update(Setmeal setmeal);

    //根据分类id查询套餐
    List<Setmeal> list(Long categoryId);

    //根据套餐id查询菜品
    List<Dish> getDishItemBySetmealId(Long setmealId);
}
